import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  // 重定向
  {
    path: '/',
   redirect:"/homepage"
  },
  // 首页
  {
    path: '/homepage',
    name: 'homepage',
    component: () => import('../views/homepage.vue')
  },
  // 社区
  {
    path: '/community',
    name: 'community',
    component: () => import('../views/community.vue')
  },
  // 我的
  {
    path: '/my',
    name: 'my',
    component: () => import('../views/my.vue')
  },
  // 消息
  {
    path: '/news',
    name: 'news',
    component: () => import('../views/news.vue')
  },
  {
    path: '/personal',
    name: 'personal',
    component: () => import('../views/personal.vue')
  },
  // 榜单
  {
    path: '/Insurance',
    name: 'Insurance',
    component: () => import('../views/Insurance.vue')
  },
  // 机票
  {
    path: '/train',
    name: 'train',
    component: () => import('../views/train.vue')
  },
  // 周边游
  {
    path: '/travel',
    name: 'travel',
    component: () => import('../views/travel.vue')
  },
  // 搜索
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search.vue')
  },
  // 详情
  {
    path: '/details/:id',
    name: 'details',
    component: () => import('../views/details.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/register.vue')
  },
  // 404页面
  {
    path:"*",
    name:"err",
    component:() => import('../views/err.vue')
  },
  // 练习页面
  {
    path:"/demofu",
    name:"demofu",
    component:() => import('../views/demofu.vue')
  }
  
]

const router = new VueRouter({

  base: process.env.BASE_URL,
  routes
})

export default router
